<template>
  <el-form :model="searchParams" label-width="auto">
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="标题">
          <el-input v-model="searchParams.name" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="日期">
          <el-date-picker
            v-model="searchParams.dateRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item>
          <el-button type="primary" @click="onSearch">搜索</el-button>
          <el-button @click="onReset">重置</el-button>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue';

const props = defineProps<{ searchParams: any }>();
const emits = defineEmits(['search', 'reset']);

function onSearch() {
  emits('search', { ...props.searchParams });
}
function onReset() {
  emits('reset');
}
</script>

<style scoped></style>
